﻿using Anley.DomainDrivenDesign.Contract.Extension;

namespace Anley.DomainDrivenDesign.Contract.Helper;

/// <summary>
/// 服务提供程序帮助类
/// </summary>
public class ServiceProviderHelper
{
    private static IServiceProvider? _serviceProvider;

    /// <summary>
    /// 服务提供程序
    /// </summary>
    public static IServiceProvider ServiceProvider =>
        _serviceProvider.NotNull(nameof(_serviceProvider));

    /// <summary>
    /// 注册服务提供程序
    /// </summary>
    /// <param name="serviceProvider"></param>
    public static void RegisterServiceProvider(
        IServiceProvider serviceProvider)
    {
        _serviceProvider = serviceProvider;
    }
}